/*
   Entry point for the 32-bit kernel.

   Based on example from http://osdever.net/tutorials/basickernel.php
*/
#include <segments.h>

.extern k_main
.extern idtp
.global start
.global idt_load
.text
.code32

start:
	movl $0x00000010, %eax	
	mov %ax, %ds
	mov %ax, %es
	mov %ax, %fs
	mov %ax, %gs
	mov $0x001FFFFF, %esp
	mov %ax, %ss

  sti
	call k_main

	cli
	jmp .	# Use infinite loop instead of hlt because QEMU's console seems
			# to lock up when using hlt.

idt_load:
  lidt (idtp)
  ret
